Image: support ImageSource with headers#8
Closed
kidroca wants to merge 14 commits intoExpensify:masterfrom
Closed
Conversation
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Details
Extend
ImageLoaderfunctionality to be able to work with image sources containing headersWe preserve the existing strategy that works with
image.srcfor cases where theImageSourceis just an
uriwith no headersWhen headers are involved we use the
fetchAPI to load the imageWhy are there 2 ways to load images?
Because
fetchorxhrdoes not work forCross origin image requests can still be made with headers (
fetch) if the server is configured correctlyFixed Issues
$ Expensify/App#12603
Test Strategy
Verify existing Image functionality has no regressions
npm run dev -w react-native-webandnpm run dev -w react-native-web-examplesImage: http://localhost:3000/imagemasterbranch. You can switch back and forth and verify the image are loading the same wayVerify Images with headers can be loaded
npm run dev -w react-native-webandnpm run dev -w react-native-web-examplesImage: http://localhost:3000/imagesourceWithHeadersherepackages/react-native-web-examples/pages/image/index.jsand try to load images from a server that expects a GET request with a header